package com.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "SINGULARES")
//@NamedQuery(name = "Singular.findSingularByLogin", query = "select s from Singular s where s.numero = :numero")
@NamedQueries({
    @NamedQuery(name="Singular.findAll",
                query="SELECT s FROM Singular s"),
    @NamedQuery(name = "Singular.findSingularByNumero", query = "select s from Singular s where s.numero = :numero"),
    @NamedQuery(name = "Singular.findSingularByNome", query = "select s from Singular s where s.nome = :nome")
}) 
public class Singular implements Serializable {
	
	private static final long serialVersionUID = 1L;

	public static final String FIND_BY_NUMERO = "Singular.findSingularByNumero";
	public static final String FIND_BY_NOME = "Singular.findSingularByNome";
	public static final String FIND_ALL = "Singular.findAll";

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(unique = true)
	private int numero;
	private String nome;
	private String razaoSocial;
	private String endereco;
	private String cidade;
	private String estado;
	private String cnpj;
	private String dn;
	private String domain;
	private String host;
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getNumero() {
		return numero;
	}

	public void setNumero(int numero) {
		this.numero = numero;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getRazaoSocial() {
		return razaoSocial;
	}

	public void setRazaoSocial(String razaoSocial) {
		this.razaoSocial = razaoSocial;
	}

	public String getEndereco() {
		return endereco;
	}

	public void setEndereco(String endereco) {
		this.endereco = endereco;
	}

	public String getCidade() {
		return cidade;
	}

	public void setCidade(String cidade) {
		this.cidade = cidade;
	}

	public String getEstado() {
		return estado;
	}

	public void setEstado(String estado) {
		this.estado = estado;
	}

	public String getCnpj() {
		return cnpj;
	}

	public void setCnpj(String cnpj) {
		this.cnpj = cnpj;
	}

	public String getDn() {
		return dn;
	}

	public void setDn(String dn) {
		this.dn = dn;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	@Override
	public int hashCode() {
		return getId();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Singular) {
			Singular singular = (Singular) obj;
			return singular.getId() == id;
		}
		return false;
	}
}